// https://www.luogu.com.cn/problem/P5737

#include <cstdio>
#include <vector>
using namespace std;

int main() {
    vector<int> ans;
    int a, b;
    scanf("%d %d", &a, &b);
    for (int i=a; i<=b; i++) {
        if (i % 400 == 0 || (i % 100 != 0 && i % 4 == 0)) {
            ans.push_back(i);
        }
    }
    printf("%d\n", static_cast<int>(ans.size()));
    for (int i=0; i<ans.size(); i++) {
        printf("%d ", ans[i]);
    }
    return 0;
}